﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Resources;
using System.Globalization;
using System.Threading;

namespace TagCloudSoma
{
    public class WordExcluder
    {
        Hashtable _hash;

        public WordExcluder()
        {
            Initialize();
        }

        #region Public Methods
            public bool Contains(string s)
            {
                if (_hash.ContainsKey(s)) return true;
                return false;
            }

            public int size()
            {
                return _hash.Count;
            }
        #endregion

        #region Initialize Method
            private void Initialize() 
            {
                ResourceManager rsxr = new ResourceManager("tagcloudsoma.resources.languages.dictionary", GetType().Assembly, null);
                ResourceSet rs = rsxr.GetResourceSet(CultureInfo.CurrentUICulture, true, true);

                IDictionaryEnumerator ide = rs.GetEnumerator();

                // Iterate through the resources and display the contents
                _hash = new Hashtable();
                while (ide.MoveNext())
                {
                    string k = (string)ide.Key;
                    string v = (string)ide.Value;
                    _hash.Add(k, v);
                }
            }
        #endregion
    }
}
